
import java.sql.*;

public class Demo09 {
    public static void main(String[] args) {
        try {
           DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
            String url = "jdbc:mysql://localhost:3306/demo?serverTimezone=GMT&useSSL=false&characterEncoding=utf-8";
            String user = "root";
            String password = "1015";
            Connection connection = DriverManager.getConnection(url, user, password);
            Statement statement = connection.createStatement();
            String sql = "insert into demo(id,name,age,email) values('1','张三','18','123456')";
            int row = statement.executeUpdate(sql);
            System.out.println("影响了数据库" + row + "条数据");
            statement.close();
            connection.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}


